home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 June: System Software / Dev.CD Jun 97 SSW.toast / What's New? / Sample Code / Toolbox / FinderDragPro / DragManagerAdditions.c next >
Encoding:
Text File  |  1997-04-23  |  2.9 KB  |  90 lines  |  [TEXT/CWIE]

  1.     //
  2.     //    This code provides glue for CFM-based programs to call the
  3.     //    the new calls documented in Technote 1043, "Drag Manager Additions".
  4.     //    You need only link this module into your program if it is
  5.     //    CFM-based (PowerPC or CFM-68K). If you link it in accidentally,
  6.     //    it will automatically render itself invisible.
  7.     //
  8.     //    Complaints and kudos to:
  9.     //
  10.     //        Pete Gontier
  11.     //        Apple Macintosh Developer Technical Support
  12.     //        <gurgle@apple.com>
  13.     //
  14.     //    LEGAL NOTICE
  15.     //    ============
  16.     //
  17.     //     You may incorporate this sample code into your applications
  18.     //     without restriction. This sample code has been provided "AS
  19.     //     IS" and the responsibility for its operation is 100% yours.
  20.     //     You are not permitted to redistribute the source as "Apple
  21.     //     sample code" after having made changes. If you're going to
  22.     //     re-distribute the source, we require that you make it clear
  23.     //     in the source that the code was descended from Apple sample
  24.     //     code, but that you've made changes.
  25.     //
  26.  
  27. #undef SystemSevenFiveOrLater
  28. #undef CGLUESUPPORTED
  29. #undef OLDROUTINENAMES
  30. #undef OLDROUTINELOCATIONS
  31. #undef STRICT_WINDOWS
  32.  
  33. #define SystemSevenFiveOrLater    1
  34. #define CGLUESUPPORTED            0
  35. #define OLDROUTINENAMES            0
  36. #define OLDROUTINELOCATIONS        0
  37. #define STRICT_WINDOWS            1
  38.  
  39. #ifndef __CONDITIONALMACROS__
  40. #    include <ConditionalMacros.h>
  41. #endif
  42.  
  43. #if GENERATINGCFM
  44.  
  45.     //
  46.     //    If we're not generating CFM, then assume the 68K inlines
  47.     //    in the headers apply instead.
  48.     //
  49.  
  50. #include "DragManagerAdditions.h"
  51.  
  52. pascal OSErr SetDragImage (    DragReference    theDragRef,
  53.                             PixMapHandle    imagePixMap,
  54.                             RgnHandle        imageRgn,
  55.                             Point            imageOffsetPt,
  56.                             DragImageFlags    theImageFlags    )
  57. {
  58.     enum
  59.     {
  60.         uppSetDragImageInfo = kD0DispatchedPascalStackBased
  61.             | RESULT_SIZE (SIZE_CODE (sizeof(OSErr)))
  62.             | DISPATCHED_STACK_ROUTINE_SELECTOR_SIZE (SIZE_CODE (sizeof (unsigned long)))
  63.             | DISPATCHED_STACK_ROUTINE_PARAMETER (1, SIZE_CODE (sizeof (theDragRef)))
  64.             | DISPATCHED_STACK_ROUTINE_PARAMETER (2, SIZE_CODE (sizeof (imagePixMap)))
  65.             | DISPATCHED_STACK_ROUTINE_PARAMETER (3, SIZE_CODE (sizeof (imageRgn)))
  66.             | DISPATCHED_STACK_ROUTINE_PARAMETER (4, SIZE_CODE (sizeof (imageOffsetPt)))
  67.             | DISPATCHED_STACK_ROUTINE_PARAMETER (5, SIZE_CODE (sizeof (theImageFlags)))
  68.     };
  69.  
  70.     return CallUniversalProc (GetToolTrapAddress (_DragDispatch), uppSetDragImageInfo, 0x27L,
  71.         theDragRef, imagePixMap, imageRgn, imageOffsetPt, theImageFlags);
  72. }
  73.  
  74. pascal OSErr GetDragHiliteColor (WindowPtr window, RGBColor *color)
  75. {
  76.     enum
  77.     {
  78.         uppGetDragHiliteColorInfo = kD0DispatchedPascalStackBased
  79.             | RESULT_SIZE (SIZE_CODE (sizeof(OSErr)))
  80.             | DISPATCHED_STACK_ROUTINE_SELECTOR_SIZE (SIZE_CODE (sizeof (unsigned long)))
  81.             | DISPATCHED_STACK_ROUTINE_PARAMETER (1, SIZE_CODE (sizeof (window)))
  82.             | DISPATCHED_STACK_ROUTINE_PARAMETER (2, SIZE_CODE (sizeof (color)))
  83.     };
  84.  
  85.     return CallUniversalProc (GetToolTrapAddress (_DragDispatch),
  86.         uppGetDragHiliteColorInfo, 0x26L, window, color);
  87. }
  88.  
  89. #endif // GENERATINGCFM
  90.